package com.fyl.pattern.singleton.demo9;

import java.io.IOException;
import java.io.InputStream;

public class RuntimeDemo {
    public static void main(String[] args) throws IOException {
        //获取runtime类的对象
        Runtime runtime = Runtime.getRuntime();
        //调用runtime的方法exec，参数要的是一个命令
        Process process = runtime.exec("ipconfig");
        InputStream is = process.getInputStream();
        byte[] arr = new byte[1024*1024*1000];
        //读数据
        int len = is.read(arr); //返回读到的字节的个数
        //将字节数组转换1为字符输出到控制台
        System.out.println(new String(arr,0,len,"GBK"));
    }
}
